home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
previe_1
/
previewp.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-10-28
|
5KB
|
161 lines
// PreviewPrintDoc.h : interface of the CPreviewPrintDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_PREVIEWPRINTDOC_H__D5E5B1B2_68E7_11D2_BEF9_0080C770FCBD__INCLUDED_)
#define AFX_PREVIEWPRINTDOC_H__D5E5B1B2_68E7_11D2_BEF9_0080C770FCBD__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CPage : public CObject
{
public:
DECLARE_SERIAL(CPage)
//members
public:
int nPage;
HMETAFILE hmf;
//methods
public:
CPage() { nPage = -1; hmf = NULL; };
~CPage() { DeleteMetaFile(hmf); };
protected:
virtual void Serialize(CArchive& ar);
};
typedef CTypedPtrArray<CObArray,CPage*> CPageArray;
class CPreviewPrintDoc : public CDocument
{
//TODO: remove this friend class
friend class CPreviewPrintView;
protected:
enum {
PPF_BOLD = 1,
PPF_ITALIC = 2,
PPF_UNDERLINE = 4,
PPF_STRIKEOUT = 8
};
protected: // create from serialization only
CPreviewPrintDoc();
DECLARE_DYNCREATE(CPreviewPrintDoc)
// Attributes
public:
CString m_strAppTitle;
protected:
BOOL m_bInDocument;
HDC m_hdcPrinter;
CMetaFileDC *m_pmfCurr;
CPageArray m_rgPage;
int m_nCurrPage;
short m_nOrientation;
short m_nPageHeight;
short m_nPageWidth;
LOGFONT m_lfCurrFont;
LOGPEN m_lpCurrPen;
CWnd m_wndOwner;
short m_nState;
// Operations
public:
int GetNumPages(void) { return m_rgPage.GetSize(); };
int GetFirstPage(void) { return m_nStartPage; };
int GetLastPage(void) { return (m_nStartPage + m_rgPage.GetSize() - 1); };
void PrintPage(int nPage, CDC *pDC, CPrintInfo* pInfo);
void SetPreviewPrintState(int nState) { m_nState = nState; };
enum {
PPSTATE_IDLE = 0,
PPSTATE_PREVIEW = 1,
PPSTATE_PRINT = 2
};
protected:
void AddLine(const CString &strLine);
BOOL CompletePage(void);
void SetUserDocInfo(const LPDEVMODE lpdm);
void SetLogFont(LOGFONT *lplf, LPCTSTR lpszFaceName,
short nSize, short nOptions, short nAngle) ;
void SetLogPen(LOGPEN *lplp, UINT nStyle, int nWidth, COLORREF nColor);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPreviewPrintDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CPreviewPrintDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CPreviewPrintDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(CPreviewPrintDoc)
short m_nStartPage;
afx_msg short GetOrientation();
afx_msg void SetOrientation(short nNewValue);
afx_msg short GetPageWidth();
afx_msg short GetPageHeight();
afx_msg long GetHwndOwner();
afx_msg void SetHwndOwner(long nNewValue);
afx_msg short GetPreviewPrintState();
afx_msg BOOL BeginDoc();
afx_msg BOOL EndDoc();
afx_msg BOOL GetPos(short FAR* x, short FAR* y);
afx_msg void MoveTo(short x, short y);
afx_msg BOOL LineTo(short x, short y);
afx_msg BOOL SetFont(LPCTSTR lpszFaceName, short nSize, short nOptions, short nAngle);
afx_msg BOOL TextOut(short x, short y, LPCTSTR szText);
afx_msg short SetTextAlign(short nOptions);
afx_msg short GetTextAlign();
afx_msg long SetBkColor(long crColor);
afx_msg long GetBkColor();
afx_msg long SetTextColor(long crColor);
afx_msg long GetTextColor();
afx_msg BOOL NewPage();
afx_msg void KillDoc();
afx_msg BOOL GetTextExtent(LPCTSTR lpszText, short FAR* nWidth, short FAR* nHeight);
afx_msg BOOL SetLineStyle(short nStyle, short nWidth, long crColor);
afx_msg void SetTitle(LPCTSTR lpszApp, LPCTSTR lpszDoc);
afx_msg BOOL ShowPreview();
afx_msg BOOL ShowPrintSetup();
afx_msg BOOL TextOutClip(short x, short y, LPCTSTR szText, short nClipLeft, short nClipTop, short nClipRight, short nClipBottom);
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PREVIEWPRINTDOC_H__D5E5B1B2_68E7_11D2_BEF9_0080C770FCBD__INCLUDED_)